#ifndef __SPECULAR__
#define __SPECULAR__

#include "BRDF.h"
#include <math.h>

namespace Engine
{
	class Specular : public Engine::BRDF
	{
	public:
		Specular()
		{}

		Specular(float p_Rs, RGBColor p_color)
		{
			m_Ks = p_Rs;
			m_Cs = p_color;
		}

		Specular(float p_Rs, float p_lobePower, RGBColor p_color)
		{
			m_Ks = p_Rs;
			m_lobePower = p_lobePower;
			m_Cs = p_color;
		}

		virtual RGBColor f(ShadeRec& sr, Point3D& wi, Point3D& w0, bool usesTexture = false)
		{
			RGBColor l(0);
			Point3D N = sr.object->GetNormal(sr.localHitPoint);
			float rayD_DotR = w0.dot(sr.ray.d);
			float lightDotN = N.dot(wi);

			float specComponent = m_Ks * (pow(rayD_DotR, 10) / lightDotN);
			return  m_Cs * specComponent;
		}

		virtual RGBColor sampleF(ShadeRec& sr, Point3D& wi, Point3D& w0)
		{
			return RGBColor(0);
		}

		virtual RGBColor rho(ShadeRec& sr, Point3D& w0)
		{
			return RGBColor(0);
		}

		void SetKs(float p_Ks)
		{
			m_Ks = p_Ks;
		}

		float GetKs()
		{
			return m_Ks;
		}


		void SetColor(RGBColor& p_Color)
		{
			m_Cs = p_Color;
		}

		RGBColor GetColor()
		{
			return m_Cs;
		}

	private:
	protected:
		//cant be greater than 0
		float m_Ks;
		float m_lobePower;
		RGBColor m_Cs;
	};
}


#endif // !__SPECULAR__
